﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ShellViewModelTests.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the <seealso cref="ShellViewModelTests" /> type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Client.Desktop.Tests.ViewModel
{
    using Hisaab.Client.Desktop.Commands;
    using Hisaab.Client.Desktop.Properties;
    using Hisaab.Client.Desktop.ViewModel;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    /// <summary>
    /// Defines the <seealso cref="ShellViewModelTests"/> type.
    /// </summary>
    [TestClass]
    public class ShellViewModelTests
    {
        /// <summary>
        /// Constructors the should set title and exit event.
        /// </summary>
        [TestMethod]
        public void ConstructorShouldSetTitleAndExitEvent()
        {
            var vm = new ShellViewModel();

            var title = string.Format("{0} - {1}", Resources.ApplicationName, Resources.Slogan);

            Assert.AreEqual(title, vm.Title);
        }

        /// <summary>
        /// Users the name should raise property changed event.
        /// </summary>
        [TestMethod]
        public void UserNameShouldRaisePropertyChangedEvent()
        {
            var vm = new ShellViewModel();
            var notifyPropertyChangedHandler = new NotifyPropertyChangedTester(vm);

            vm.UserName = "Some new user";

            notifyPropertyChangedHandler.AssertChange(0, "UserName");
        }

        /// <summary>
        /// Exits the command should return exit command object.
        /// </summary>
        [TestMethod]
        public void ExitCommandShouldReturnExitCommandObject()
        {
            var vm = new ShellViewModel();

            Assert.IsInstanceOfType(vm.ExitApplication, typeof(ExitCommand));
        }
    }
}